﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QFramework;
using UnityEngine;

namespace ProjectIndieFarm
{
    /// <summary>
    /// 配置表
    /// </summary>
    public class Config
    {
        public const int INIT_COINS = 100;
        public const int INIT_DAYS = 1;
        public const int INIT_HOURS = 10;
        public const int INIT_DAILY_COST = 10;
        public const int INIT_SOIL_GRID_WIDTH = 4;
        public const int INIT_SOIL_GRID_HEIGHT = 4;

        #region tool hour cost
        //hand
        public const float INIT_TOOL_HOUR_COST_HAND = 0.2f;
        public const float LV1_TOOL_HOUR_COST_HAND = 0.15f;
        public const float LV2_TOOL_HOUR_COST_HAND = 0.10f;
        public const float LV3_TOOL_HOUR_COST_HAND = 0.08f;
        public const float LV4_TOOL_HOUR_COST_HAND = 0.07f;
        public const float LV5_TOOL_HOUR_COST_HAND = 0.06f;
        public const float LV6_TOOL_HOUR_COST_HAND = 0.05f;
        public const float LV7_TOOL_HOUR_COST_HAND = 0.04f;
        public const float LV8_TOOL_HOUR_COST_HAND = 0.03f;
        public const float LV9_TOOL_HOUR_COST_HAND = 0.02f;
        public const float LV10_TOOL_HOUR_COST_HAND = 0.01f;
        //hoe
        public const float INIT_TOOL_HOUR_COST_HOE = 0.3f;
        public const float LV1_TOOL_HOUR_COST_HOE = 0.25f;
        public const float LV2_TOOL_HOUR_COST_HOE = 0.20f;
        public const float LV3_TOOL_HOUR_COST_HOE = 0.15f;
        public const float LV4_TOOL_HOUR_COST_HOE = 0.12f;
        public const float LV5_TOOL_HOUR_COST_HOE = 0.10f;
        public const float LV6_TOOL_HOUR_COST_HOE = 0.08f;
        public const float LV7_TOOL_HOUR_COST_HOE = 0.05f;
        public const float LV8_TOOL_HOUR_COST_HOE = 0.03f;
        public const float LV9_TOOL_HOUR_COST_HOE = 0.02f;
        public const float LV10_TOOL_HOUR_COST_HOE = 0.01f;
        //seed
        public const float INIT_TOOL_HOUR_COST_SEED = 0.2f;
        public const float LV1_TOOL_HOUR_COST_SEED = 0.15f;
        public const float LV2_TOOL_HOUR_COST_SEED = 0.10f;
        public const float LV3_TOOL_HOUR_COST_SEED = 0.08f;
        public const float LV4_TOOL_HOUR_COST_SEED = 0.07f;
        public const float LV5_TOOL_HOUR_COST_SEED = 0.06f;
        public const float LV6_TOOL_HOUR_COST_SEED = 0.05f;
        public const float LV7_TOOL_HOUR_COST_SEED = 0.04f;
        public const float LV8_TOOL_HOUR_COST_SEED = 0.03f;
        public const float LV9_TOOL_HOUR_COST_SEED = 0.02f;
        public const float LV10_TOOL_HOUR_COST_SEED = 0.01f;
        //water pot
        public const float INIT_TOOL_HOUR_COST_WATER_POT = 0.1f;
        public const float LV1_TOOL_HOUR_COST_WATER_POT = 0.07f;
        public const float LV2_TOOL_HOUR_COST_WATER_POT = 0.06f;
        public const float LV3_TOOL_HOUR_COST_WATER_POT = 0.05f;
        public const float LV4_TOOL_HOUR_COST_WATER_POT = 0.04f;
        public const float LV5_TOOL_HOUR_COST_WATER_POT = 0.03f;
        public const float LV6_TOOL_HOUR_COST_WATER_POT = 0.025f;
        public const float LV7_TOOL_HOUR_COST_WATER_POT = 0.020f;
        public const float LV8_TOOL_HOUR_COST_WATER_POT = 0.015f;
        public const float LV9_TOOL_HOUR_COST_WATER_POT = 0.012f;
        public const float LV10_TOOL_HOUR_COST_WATER_POT = 0.01f;
        #endregion

        /// <summary>
        /// 道具 物品池
        /// </summary>
        /// <remarks>
        /// 工具 种子 成熟植物 
        /// </remarks>
        public static Dictionary<string, Item> ItemForName = new()
        {
            {"hand",CreateToolHand()},
            {"hoe", CreateToolHoe()},
            {"water_pot",CreateToolWaterPot()},
            {"seed_carrot",CreateSeedCarrot()},
            {"seed_pumpkin",CreateSeedPumpkin()},
            {"seed_potato",CreateSeedPotato()},
            {"seed_tomato",CreateSeedTomato()},
            {"seed_beans",CreateSeedBeans()},
            {"item_carrot",CreatePlantCarrot()},
            {"item_pumpkin",CreatePlantPumpkin()},
            {"item_potato",CreatePlantPotato()},
            {"item_tomato",CreatePlantTomato()},
            {"item_beans",CreatePlantBeans()},
        };

        #region create item
        //手
        public static Item CreateToolHand()
        {
            return new Item()
            {
                Name = "hand",
                IconName = "ToolHand_0",
                Countable = false,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = new ToolHand(),
            };
        }
        //锄头
        public static Item CreateToolHoe()
        {
            return new Item()
            {
                Name = "hoe",
                IconName = "ToolHoe_0",
                Countable = false,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = new ToolHoe(),
            };
        }
        public static Item CreateToolWaterPot()
        {
            return new Item()
            {     //水壶
                Name = "water_pot",
                IconName = "ToolWateringPot_0",
                Countable = false,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = new ToolWateringPot(),
            };

        }
        public static Item CreateSeedCarrot(int count = 5)
        {
            return new Item()
            {     //胡萝卜种子
                Name = "seed_carrot",
                IconName = "ToolSeed_Carrot_0",
                Countable = true,
                IsPlant = true,
                PlantPrefabName = "Plant_Carrot",
                Tool = new ToolSeed()
            };
        }
        public static Item CreateSeedPumpkin(int count = 5)
        {
            return new Item()
            {     //南瓜种子
                Name = "seed_pumpkin",
                IconName = "ToolSeed_Pumpkin_0",
                Countable = true,
                IsPlant = true,
                PlantPrefabName = "Plant_Pumpkin",
                Tool = new ToolSeed()
            };
        }
        public static Item CreateSeedPotato(int count = 5)
        {
            return new Item()
            {     //土豆种子
                Name = "seed_potato",
                IconName = "ToolSeed_Potato_0",
                Countable = true,
                IsPlant = true,
                PlantPrefabName = "Plant_Potato",
                Tool = new ToolSeed()
            };
        }
        public static Item CreateSeedTomato(int count = 5)
        {
            return new Item()
            {     //西红柿种子
                Name = "seed_tomato",
                IconName = "ToolSeed_Tomato_0",
                Countable = true,
                IsPlant = true,
                PlantPrefabName = "Plant_Tomato",
                Tool = new ToolSeed()
            };
        }
        public static Item CreateSeedBeans(int count = 5)
        {
            return new Item()
            {     //豆角种子
                Name = "seed_beans",
                IconName = "ToolSeed_Beans_0",
                Countable = true,
                IsPlant = true,
                PlantPrefabName = "Plant_Beans",
                Tool = new ToolSeed()
            };
        }
        public static Item CreatePlantCarrot(int count = 1)
        {
            return new Item()
            {     //胡萝卜
                Name = "item_carrot",
                IconName = "ItemIcon_Carrot_0",
                Countable = true,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = null,
            };
        }
        public static Item CreatePlantPumpkin(int count = 1)
        {
            return new Item()
            {     //南瓜
                Name = "item_pumpkin",
                IconName = "ItemIcon_Pumpkin_0",
                Countable = true,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = null,
            };
        }
        public static Item CreatePlantPotato(int count = 1)
        {
            return new Item()
            {     //土豆
                Name = "item_potato",
                IconName = "ItemIcon_Potato_0",
                Countable = true,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = null,
            };
        }
        public static Item CreatePlantTomato(int count = 1)
        {
            return new Item()
            {     //西红柿
                Name = "item_tomato",
                IconName = "ItemIcon_Tomato_0",
                Countable = true,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = null,
            };
        }
        public static Item CreatePlantBeans(int count = 1)
        {
            return new Item()
            {     //豆角
                Name = "item_beans",
                IconName = "ItemIcon_Beans_0",
                Countable = true,
                IsPlant = false,
                PlantPrefabName = string.Empty,
                Tool = null,
            };
        }
        #endregion
    }
}
